package top.riske.animalhazardassessment.common.DTO;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.riske.animalhazardassessment.common.entity.Account;

import java.time.LocalDateTime;

@Data
public class AccountDto {

    @TableId(type = IdType.AUTO)
    private Long id;

    @Schema(description = "用户名")
    @TableField(value = "username")
    private String username;

    @Schema(description = "昵称")
    @TableField(value = "nickname")
    private String nickname;

    @Schema(description = "性别,0-男，1-女")
    private String gender;

    @Schema(description = "电话")
    @TableField(value = "phone")
    private String phone;

    @Schema(description = "邮箱")
    @TableField(value = "email")
    private String email;

    @Schema(description = "头像")
    @TableField(value = "avatar")
    private String avatar;

    @Schema(description = "微信id")
    @TableField(value = "weixin_id")
    private String weixinId;

    @Schema(description = "角色")
    @TableField(value = "role")
    private Integer role;

    @Schema(description = "状态码")
    @TableField(value = "status")
    private Integer status;

    @Schema(description = "注册时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    public AccountDto() {
    }

    public Account toEntity(){
        return new Account(id,username, nickname,gender, phone, email, avatar, weixinId, role, status, createTime);
    }

    public AccountDto(Long id, String username, String nickname,String gender, String phone, String email, String avatar, String weixinId, Integer role, Integer status, LocalDateTime createTime) {
        this.id = id;
        this.username = username;
        this.nickname = nickname;
        this.gender = gender;
        this.phone = phone;
        this.email = email;
        this.avatar = avatar;
        this.weixinId = weixinId;
        this.role = role;
        this.status = status;
        this.createTime = createTime;
    }
}
